package com.learn.Controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DJJ_F
 * @version 1.0
 * @date 2025/03/21
 * @description 测试异常处理的控制器
 */
@RestController
public class ErrorController {
    @GetMapping("/getUserById")
    public String getUserById(@RequestParam("id") Integer id) {
        if(id < 1) {
            throw new RuntimeException("无效id");
        }
        return "id号为：" + id;
    }
}
